package points 
{
	import constants.utils;
	import structures.Structure;
	/**
	 * ...
	 * @author parasitic
	 */
	public class CollidePoint extends BasePoint 
	{ 
		private var dist_hyp:Number;
		private var dist_col:Number;
		
		protected var collided:Boolean = false;
		
		protected function setCollided(b:Boolean):void
		{
			collided = b;
		}
		
		public function isCollided():Boolean
		{
			return collided;
		}
		
		public function test(other:CollidePoint):Boolean
		{
			dist_hyp = utils.getDistance(get_x(), get_y(), other.get_x(), other.get_y());
			dist_col = getRadius() + other.getRadius();
			
			return dist_hyp < dist_col;
		}
		
		public function testArray(item:CollidePoint, index:int, a:Array):Boolean
		{
			var hit:Boolean = this.test(item);
			if (this instanceof Structure)
			{
				(this as Structure).collideUpdate(hit);
			}
			return !hit;
		}
		
	}

}